namespace Asmex.FileViewer
{
    using System;
    using System.Reflection;
    using System.Text;

    public class Row
    {
        private TableCell[] _cells;
        private Asmex.FileViewer.Table _table;

        public Row(TableCell[] cells, Asmex.FileViewer.Table table)
        {
            this._cells = cells;
            this._table = table;
        }

        public string CookedString()
        {
            StringBuilder builder = new StringBuilder(100);
            for (int i = 0; i < this._cells.Length; i++)
            {
                builder.Append(this._cells[i].Data.ToString());
                if (i < (this._cells.Length - 1))
                {
                    builder.Append("   --    ");
                }
            }
            return builder.ToString();
        }

        public string RawString()
        {
            StringBuilder builder = new StringBuilder(100);
            for (int i = 0; i < this._cells.Length; i++)
            {
                builder.Append(this._cells[i].RawData.ToString("X8"));
                if (i < (this._cells.Length - 1))
                {
                    builder.Append("   --    ");
                }
            }
            return builder.ToString();
        }

        public override string ToString()
        {
            return this.RawString();
        }

        public TableCell this[int index]
        {
            get
            {
                return this._cells[index];
            }
        }

        public Asmex.FileViewer.Table Table
        {
            get
            {
                return this._table;
            }
        }
    }
}
